<%-- 
    Document   : testShipGoods
    Created on : Mar 19, 2013, 10:07:35 PM
    Author     : Shaun McCready
--%>

<%@page import="org.warehouse1.ItemShippingStatusList"%>
<%@page import="org.warehouse1.Item"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <link href="style.css" rel="stylesheet" type="text/css">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Testing the Warehouse shipGoods() Function</title>
    </head>
    <body>
        <h1>Testing the Warehouse shipGoods() Function</h1>

        <form action="serv" method="POST">
            <table border="0">
                <tr>
                    <td class="bold">Customer Reference Number: </td>
                    <td><input type="text" name="custrefnum"> </td>
                </tr>
                <tr>
                    <th>Manufacturer</th>
                    <th>Product Type</th>
                    <th>Quantity</th>
                </tr>
                <!-- 1st Line -->
                <tr>
                    <td>
                        <select name="manu1">
                            <option value="manufacturer1">1</option>
                            <option value="manufacturer2">2</option>
                            <option value="manufacturer3">3</option>
                        </select>
                    </td>
                    <td>DVD Player</td>
                    <td><input type="text" name="quantity1"> </td>
                </tr>
                <!-- 2nd Line -->
                <tr>
                    <td>
                        <select name="manu2">
                            <option value="manufacturer1">1</option>
                            <option value="manufacturer2">2</option>
                            <option value="manufacturer3">3</option>
                        </select>
                    </td>
                    <td>Video Camera</td>
                    <td><input type="text" name="quantity2"> </td>
                </tr>
                <!-- 3rd Line -->
                <tr>
                    <td>
                        <select name="manu3">
                            <option value="manufacturer1">1</option>
                            <option value="manufacturer2">2</option>
                            <option value="manufacturer3">3</option>
                        </select>
                    </td>
                    <td>TV</td>
                    <td><input type="text" name="quantity3"> </td>
                </tr>
            </table>
            <input type="Submit" value="Submit Info">
        </form>

            <br /><br /><br />
            


            <%
       
                ItemShippingStatusList issl = (ItemShippingStatusList) request.getAttribute("result");

                if (issl != null) {

               if(!issl.getShippedItems().isEmpty())
                                  {
                   List<Item> listofstuff = issl.getShippedItems();

            %>

            <h2>Shipped Items:</h2>
            <table border="0">
                <tr>
                    <th>Manufacturer</th>
                    <th>Product Type</th>
                    <th>Quantity</th>
                </tr>
                <%
                    for (Item item : listofstuff) {
                %>
                <tr>
                    <td><%=item.getManufacturerName()%> </td>
                    <td><%=item.getProductType()%> </td>
                    <td><%=item.getQuantity()%></td>
                </tr>
                <%
                    }
                                       }
                %>
            </table>

            <%
                if (!issl.getNotShippedItems().isEmpty()) {
                    List<Item> listofnonstuff = issl.getNotShippedItems();
            %>

            <h2>Non-Shipped Items:</h2>
            <table border="0">
                <tr>
                    <th>Manufacturer</th>
                    <th>Product Type</th>
                    <th>Quantity</th>
                </tr>
                <%
                    for (Item item : listofnonstuff) {
                %>
                <tr>
                    <td><%=item.getManufacturerName()%> </td>
                    <td><%=item.getProductType()%> </td>
                    <td><%=item.getQuantity()%></td>
                </tr>
                <%
                    }
                %>

            </table>

            <%
                }
                                       }
             %>

    </body>
</html>

